﻿@{
	ViewBag.Title = "Site Settings";
	Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
@model DirigoEdge.Areas.Admin.Models.ViewModels.SiteSettingsViewModel

<div class="siteSettings">
    <div class="row">
        <div class="twelve columns">
            <h3><i class="fa fa-wrench"></i> Site Settings</h3>
        </div>
    </div>

    <div class="row">
        <div class="four columns mobile-two">
            <label class="right inline">Google Analytics ID</label>
        </div>
        <div class="eight columns  mobile-two">
            <form class="custom">
                <input type="text" class="eight commentBelow saveField" data-field="GoogleAnalyticsId" autocomplete="off" value="@Model.Settings.GoogleAnalyticsId" />
                <div class="settingsComment hide-for-small">Your Google Analytics Tracking Id. Ex : UA-XXXXX-X</div>
            </form>
        </div>
    </div>
    
    <div class="row">
        <div class="four columns mobile-two">
            <label class="right inline">Contact E-Mail</label>
        </div>
        <div class="eight columns  mobile-two">
            <form class="custom">
                <input type="text" class="eight commentBelow saveField" data-field="ContactEmail" autocomplete="off" value="@Model.Settings.ContactEmail" />
                <div class="settingsComment hide-for-small">Contact Form and other generic e-mails will be sent here.</div>
            </form>

        </div>
    </div>
    
    <div class="row">
        <div class="four columns mobile-two">
            <label class="right inline">Search Index</label>
        </div>
        <div class="eight columns  mobile-two">
            <form class="custom">
                @{
                    string isChecked = Model.Settings.SearchIndex ? "checked = checked" : "";
                }
                <input class="custom saveField" data-field="SearchIndex" type="checkbox" @isChecked />
                <div class="settingsComment hide-for-small">Allow search engines to index this site.</div>
            </form>
            
        </div>
    </div>


    <div class="row">
        <div class="four columns mobile-two">
            <label class="right inline">Enable Content Revisions</label>
        </div>
        <div class="eight columns  mobile-two">
            <form class="custom">
                @{
                    string iChecked = Model.Settings.ContentPageRevisionsEnabled ? "checked = checked" : "";
                }
                <input class="custom saveField" data-field="ContentPageRevisionsEnabled" type="checkbox" @iChecked />
                <div class="settingsComment hide-for-small">*Disabling Revisions will delete all existing revisions!</div>
            </form>
        </div>
    </div>

    <div class="retension row ">
        <div class="four columns mobile-two">
            <label class="right inline">Revision Retension Policy</label>
        </div>
        <div class="eight columns  mobile-two">
            <form class="custom">
                Keep the latest
                <select class="saveField" data-field="ContentPageRevisionsRetensionCount">
                    
                    @{
                        foreach (var kvp in Model.SiteRetensionTimeValues)
                        {
                            string selected = kvp.Value ? "selected='selected'" : "";
                            <option @selected>@kvp.Key</option>    
                        }
                    }
                </select>
                revisions
            </form>
        </div>
    </div>
    
    <div class="row">
        <div class="four columns mobile-two">
            <label class="right inline">Default User Role</label>
        </div>
        <div class="eight columns  mobile-two">
            <form class="custom">
                <select class="saveField" data-field="DefaultUserRole">
                    
                    @{
                        foreach (string role in Model.RolesList)
                        {
                            string selected = Model.Settings.DefaultUserRole == role ? "selected='selected'" : "";
                            <option @selected>@role</option>    
                        }
                    }
                </select>
                <div class="settingsComment hide-for-small">Default User Role to assign to newly registered users.</div>
            </form>
        </div>
    </div>
    
    
    


    <div class="row">
        <div class="twelve columns">
            <div class="contain left">
                <a class="button mobileMarginBottom savePageButton" data-url="/settings/sitesettings/">Save</a>
                <div id="SaveIndicator"></div>
            </div>
        </div>
    </div>
    
</div>

@section Scripts {
    <script src="/Areas/Admin/Scripts/siteSettings.js"></script>
}